home *** CD-ROM | disk | FTP | other *** search
/ Gigarom 1 / Gigarom Macintosh Archives (Quantum Leap)(CDRM1080320)(1993).iso / FILES / HYP / A-B / AutoCat.cpt / AutoCat / stack.txt < prev   
Text File  |  1989-02-26  |  7KB  |  233 lines

  1. -- stack: in
  2. -- format: 8 (HyperCard 1)
  3. -- flags: 0x0 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=0, y1=0, x2=0, y2=0)
  7. -- screen: Rect(x1=0, y1=0, x2=0, y2=0)
  8. -- card dimensions: w=0 h=0
  9. -- scroll: x=0 y=0
  10. -- background count: 5
  11. -- first background id: 2726
  12. -- card count: 15
  13. -- first card id: 6151
  14. -- list block id: 7244
  15. -- print block id: 4793
  16. -- font table block id: 0
  17. -- style table block id: 0
  18. -- free block count: 3
  19. -- free size: 3744 bytes
  20. -- total size: 78848 bytes
  21. -- stack block size: 6144 bytes
  22. -- created by hypercard version: 0x00000000
  23. -- compacted by hypercard version: 0x00000000
  24. -- modified by hypercard version: 0x00000000
  25. -- opened by hypercard version: 0x01208000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0x0
  67. ----- HyperTalk script -----
  68. -- init stack
  69. on openStack
  70.   initAll
  71. end openStack
  72.  
  73. on resume
  74.   initAll
  75.   pass resume
  76. end resume
  77.  
  78. on startUp
  79.   initAll
  80.   pass startUp
  81. end startUp
  82.  
  83. on initAll
  84.   push recent card
  85.  
  86.   -- flag whether New Card commands are from user or from XCMD
  87.   global fromXCMD, volumeXCMD,hardDisk,applPath
  88.  
  89.   -- init Find string and buttons
  90.   global sourceString
  91.   put empty into sourceString
  92.   global selectedText, whichButton,whichFindButton
  93.  
  94.   -- the ShowPath XFCN will return an Application's pathname
  95.   --in this global if the "Record" button is clicked
  96.   put empty into applPath
  97.  
  98.   put false into fromXCMD -- New Card command is from user
  99.   put false into hardDisk -- Floppies being cataloged
  100.  
  101.  
  102.   -- field remembers Find dialog box settings between stack uses
  103.   get line 2 of card field "Hold Globals" of card "AutoCat Index"
  104.   if it is not empty then
  105.     put line 1 of card field "Hold Globals" of card "AutoCat Index" into selectedText
  106.     put line 2 of card field "Hold Globals" of card "AutoCat Index" into whichButton
  107.     put line 3 of card field "Hold Globals" of card "AutoCat Index" into whichFindButton
  108.   else
  109.     -- if it doesn't remember, set defaults
  110.     put empty into selectedText
  111.     put 1 into whichButton
  112.     put 1 into whichFindButton
  113.   end if
  114. end initAll
  115.  
  116.  
  117.  
  118. on closeStack
  119.   -- record find dialog box's most recent settings
  120.   global selectedText, whichButton,whichFindButton
  121.   put selectedText into line 1 of card field "Hold Globals" of card "AutoCat Index"
  122.   put whichButton into line 2 of card field "Hold Globals" of card "AutoCat Index"
  123.   put whichFindButton into line 3 of card field "Hold Globals" of card "AutoCat Index"
  124.  
  125.   -- Auto Compact stack if necessary
  126.   if the freeSize of this stack >= 15000 then
  127.     answer "The AutoCat Stack has " & round(the freeSize of this stack/1024) & "k free, Compact?" with  "NO" or "OK"
  128.     if it is "OK" then doMenu "compact stack"
  129.   end if
  130. end closeStack
  131.  
  132. --find field line clicked on in a scrlloing field
  133. Function lineClicked
  134. return (trunc(((scroll of the target) + (item two of the clickloc) - (item two of the rect of the target)) div the textheight of the target) + one)
  135. end lineClicked
  136.  
  137.  
  138. on returnKey
  139.   global sourceString -- last find string
  140.   if sourceString is not empty then -- continue search
  141.     set cursor to 4
  142.     searchAC 0
  143.   else
  144.     pass returnKey
  145.   end if
  146. end returnKey
  147.  
  148. on searchAC flag
  149.   -- which field to search, what mode to use, e.g., chars, word...
  150.   -- these globals are maintained by the SearchAutoCat XFCN
  151.   global whichButton,whichFindButton
  152.   -- the source
  153.   global sourceString
  154.  
  155.   -- a simple XFCN which puts up a dialog box looking for the search
  156.   -- string and the options
  157.  
  158.   if flag >0 then
  159.     put SearchAutoCat () into sourceString
  160.   end if
  161.  
  162.   if sourceString is empty then exit searchAC
  163.  
  164.   -- the XFCN returns 1,2, or 3 for which find mode button was set
  165.  
  166.   if whichButton contains 1 then -- search all fields
  167.     if whichFindButton contains 1 then -- look at beginnings of words
  168.       find sourceString
  169.     end if -- wfb 1
  170.     if whichFindButton contains 2 then -- look at words only
  171.       find word sourceString
  172.     end if -- wfb 2
  173.     if whichFindButton contains 3 then -- look at chars
  174.       find chars sourceString
  175.     end if -- wfb 3
  176.   end if  -- whichButton
  177.  
  178.   -- XFCN returns 1-8 depending on which field button was set
  179.  
  180.   if whichButton contains 2 then
  181.     SearchFields 9, 3424
  182.   end if
  183.   if whichButton contains 3 then
  184.     SearchFields 1, 3424
  185.   end if
  186.   if whichButton contains 4 then
  187.     SearchFields 1, 2241
  188.   end if
  189.   if whichButton contains 5 then
  190.     SearchFields 2, 2241
  191.   end if
  192.   if whichButton contains 6 then
  193.     SearchFields 61, 2241
  194.   end if
  195.   if whichButton contains 7 then
  196.     SearchFields 62, 2241
  197.   end if
  198.   if whichButton contains 8 then
  199.     SearchFields 50, 2241
  200.   end if
  201. end searchAC
  202.  
  203.  
  204. on SearchFields fieldID,bkgndID
  205.   global whichButton,whichFindButton,sourceString
  206.  
  207.   -- go to the proper bkgnd to begin search
  208.   if the ID of this bkgnd is not bkgndID then
  209.     go to bkgnd ID bkgndID
  210.   end if
  211.   if whichFindButton contains 1 then -- look at beginnings of words
  212.     find sourceString in bkgnd field ID fieldID
  213.   end if -- wfb 1
  214.   if whichFindButton contains 2 then -- look at words only
  215.     find word sourceString in bkgnd field ID fieldID
  216.   end if -- wfb 2
  217.   if whichFindButton contains 3 then -- look at chars
  218.     find chars sourceString in bkgnd field ID fieldID
  219.   end if -- wfb 3
  220.   send mouseWithin to bkgnd field ID fieldID
  221. end SearchFields
  222.  
  223. on doMenu which
  224.   -- trap command-F to bring up Find dialog box
  225.   if which is "Find..." then
  226.     searchAC 1
  227.   else
  228.     pass doMenu
  229.   end if
  230. end doMenu
  231.  
  232.  
  233.